<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户注册</title>
    <style>
        *  {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 20px;
            background: url(img/body.jpg) no-repeat center top;
            background-size: 1400px 1000px;

        }
        .container {
            max-width: 500px;
            margin: 0 auto;
            background: #fff;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
            margin-top: 30px;
        }
        h2 {
            text-align: center;
            color: #333;
        }
        /*.form-group {*/
        /*    margin-bottom: 15px;*/
        /*}*/
        label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
        }
        /*input[type="text"],*/
        /*input[type="password"],*/
        /*input[type="email"] {*/
        /*    width: 100%;*/
        /*    padding: 10px;*/
        /*    border: 1px solid #ddd;*/
        /*    border-radius: 4px;*/
        /*    box-sizing: border-box;*/
        /*}*/
        input[type="submit"] {
            background-color: #4CAF50;
            color: white;
            padding: 12px 20px;
            border: none;
            border-radius: 20px;
            cursor: pointer;
            width: 100%;
            font-size: 16px;
        }
        input[type="submit"]:hover {
            background-color: #45a049;
        }
        .error {
            color: red;
            font-size: 14px;
        }
        .success {
            color: green;
            font-size: 14px;
        }
        .tj{
            width: 200px;
            margin: 0 auto;
        }
    </style>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <script src="/layui/layui.js"></script>
    <script src="/layui/jquery-3.6.0.min.js"></script>
    <script>
        $(function () {
            layui.use(['form', 'layedit', 'laydate'], function () {
                var form = layui.form
                    , layedit = layui.layedit
                    , laydate = layui.laydate;
            });
        })
    </script>
</head>
<body>
<div class="container">
    <h2>用户注册</h2>
    <%-- 显示错误消息 --%>
        <% if(request.getAttribute("errorMessage") != null) { %>
    <div class="error"><%= request.getAttribute("errorMessage") %></div>
        <% } %>

    <%-- 显示成功消息 --%>
        <% if(request.getAttribute("successMessage") != null) { %>
    <div class="success"><%= request.getAttribute("successMessage") %></div>
        <% } %>
    <div class="layui-bg-gray" style="padding: 0px;">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <form class="layui-form layui-form-pane" action="/users/add1" method="post">
                            <div class="layui-form-item">
                                <label class="layui-form-label">账号</label>
                                <div class="layui-input-block">
                                    <input type="text" name="username" required lay-verify="required" autocomplete="off"
                                           class="layui-input" >
                                </div>
                                <br>
                                <label class="layui-form-label">密码</label>
                                <div class="layui-input-block">
                                    <input type="password" name="password" required lay-verify="required"
                                           autocomplete="off" class="layui-input" >
                                </div>

                                <br>
                                <label class="layui-form-label">邮箱</label>
                                <div class="layui-input-block">
                                    <input type="text" name="email" required lay-verify="required" autocomplete="off"
                                           class="layui-input" >
                                </div>
                                <br>
                                <label class="layui-form-label">手机号</label>
                                <div class="layui-input-block">
                                    <input type="text" name="phoneNum" required lay-verify="required"
                                           autocomplete="off" class="layui-input" >
                                </div>
                                <br>
                                <label class="layui-form-label">账号状态</label>
                                <div class="layui-input-block">
                                    <select name="status" lay-verify="required">
                                        <option value="0" selected>未开启</option>
                                        <option value="1">开启</option>

                                    </select>
                                </div>
                                <br>
                                <label class="layui-form-label">用户角色</label>
                                <div class="layui-input-block">
<%--                                    <select name="roleId" lay-verify="required">--%>
<%--    <select name="roleId" lay-verify="required">--%>
<%--        <c:forEach items="${roleList}" var="role">--%>
<%--        <option value="${role.id}">${role.roleName}</option>--%>
<%--        </c:forEach>--%>
<%--                                    </select>--%>
    <select name="roleId" lay-verify="required">
        <option value="6">管理员</option>
        <option value="7">学生</option>
        <option value="8">老师</option>
    </select>
                                </div>
                            </div>
                            <div class="tj">
                                <input type="submit" value="注册">
                            </div>
                        </form>
                        <p>已有账号? &nbsp;&nbsp;<a href="login.jsp">立即登录</a></p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>